<extend name="Index/index"/>
<block name='right'>
<div class="rightBody">
	<span class='title'>添加商铺</span>
	<div id="content">
		<form  class='registerform' action="<{:U('Shop/add_handle')}>" method="post">
		<table class='table table-striped table-bordered'>
			<thead>
				<tr>
					<th width="20%">名称</th>
					<th>值</th>
				</tr>
			</thead>
			<tbody>
				<tr>
					<td>商铺名称</td>
					<td>
						<input type="text" name="shopname" datatype="*2-15" errormsg="长度2-15位任意字符"  nullmsg="商铺名称不能为空" sucmsg="填写正确"/>
						<span class="Validform_checktip" >请输入2-15位任意字符</span>
					</td>
				</tr>
				<tr>
					<td>商铺地址</td>
					<td>
						<input type="text" name="shopaddress" datatype="*2-100" errormsg="长度2-100位任意字符"  nullmsg="商铺地址不能为空" sucmsg="填写正确"/>
						<span class="Validform_checktip" >地址长度不能超过100个字符</span>
					</td>
				</tr>
				<tr>
					<td>地铁地址</td>
					<td>
						<input type="text" name="metroaddress" datatype="*2-100" errormsg="长度2-100位任意字符"  nullmsg="商铺地铁地址不能为空" sucmsg="填写正确"/>
						<span class="Validform_checktip" >地铁地址长度不能超过100个字符</span>
					</td>
				</tr>
				<tr>
					<td>商铺电话</td>
					<td>
						<input type="text" name="shoptel" datatype="m" errormsg="电话格式不正确"  nullmsg="商铺电话不能为空" sucmsg="填写正确"/>
						<span class="Validform_checktip" >请输入正确的电话</span>
					</td>
				</tr>
				<tr>
					<td>商铺坐标</td>
					<td>
						<input type="text" id='shopcoord' name="shopcoord" />
						<a id='getpoint' href="javascript:" class="btn btn-info">获取坐标</a>
					</td>
				</tr>
				<tr>
					<td></td>
					<td><input type="submit" class='btn btn-primary' /></td>
				</tr>
			</tbody>
		</table>
		</form>
	</div>
</div>
<script type="text/javascript">
	// 点击获取坐标，把文字传到getPoint方法里，使得到的坐标填充到input框中
	$('#getpoint').click(function(){
		if($('#shopcoord').val()==''){
			alert('请填写地址！');
		}
		var adds=$('#shopcoord').val();
		getPoint(adds);
	});
	// 获得地址坐标函数
	function getPoint(adds){
		// 创建地址解析器实例
		var myGeo = new BMap.Geocoder();
		// 将地址解析结果显示在地图上,并调整地图视野
		myGeo.getPoint(adds, function(point){
			$('#shopcoord').val(JSON.stringify(point));
		}, "北京市");
	};
	
</script>
</block>
